POV-Ray : Newsgroups : povray.binaries.images : First example of my HF macros : Re: First example of my HF macros Server Time
16 Aug 2024 08:15:47 EDT (-0400)
  Re: First example of my HF macros  
From: Hugo
Date: 7 Mar 2002 11:25:50
Message: <3c87948e@news.povray.org>
Hi Shay,

I'm glad you like it! I must admit the normalizing code is still the one
from your first version. I have been busy with implementing vertex-blurring
(not connected with normal smoothing). And I use a fixed 4 times
"oversampling" during trace of the original object, that improves shape. All
in all those things add to the parse time, but none of them are extremely
slow by themselves.

I'd very much like to see what you have in mind. I have no idea how it works
as a function {} But before you spend a lot of time writing new code, maybe
I should show how I implemented the first one. It was the section about
storing normals in an array, that I really needed, the rest was already
working in my code. So I removed my normal junk-code and used this:

// My macro to calculate normal of a triangle plane
#macro CalcNorm(Face_Cnt)
 #local V1=Vertices[Faces[Face_Cnt].x];
 #local V2=Vertices[Faces[Face_Cnt].y];
 #local V3=Vertices[Faces[Face_Cnt].z];
 vcross(V2-V1,V3-V1);
#end

 // Find normals of 2 faces in a sqaure
    #local Normal_1=CalcNorm(Face_Cnt);
    #local Normal_2=CalcNorm(Face_Cnt+1);

// Your code:
 #declare Mesh_Normals[Column_Counter][Row_Counter] =
    Mesh_Normals[Column_Counter][Row_Counter]
    +Normal_1 +Normal_2;
 #declare Mesh_Normals[Column_Counter+1][Row_Counter] =
    Mesh_Normals[Column_Counter][Row_Counter+1]
    +Normal_1;
 #declare Mesh_Normals[Column_Counter+1][Row_Counter+1] =
    Mesh_Normals[Column_Counter+1][Row_Counter+1]
    +Normal_1 +Normal_2;
 #declare Mesh_Normals[Column_Counter][Row_Counter+1] =
    Mesh_Normals[Column_Counter][Row_Counter+1]
    +Normal_2;

... and the same code again for the other case-status but with swapped
normal_1 / normal_2 addition.. Will your extended code be able to fit in
here somewhere?  :o)

Regards,
Hugo


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.